function checkStrength(password) {
  const letters = 'abcdefghijklmnopqrstuvwxyz';
  const specialChars = '!@#$%^&*';
  const nums = '0123456789';
  let level = 0;
  if (password.length >= 8) level++;
  for (const char of password) {
    if (letters.includes(char)) {
      level += 0.5;
      break;
    }
  }
  for (const char of password) {
    if (letters.toUpperCase().includes(char)) {
      level += 0.5;
      break;
    }
  }
  for (const char of password) {
    if (nums.includes(char)) {
      level++;
      break;
    }
  }
  for (const char of password) {
    if (specialChars.includes(char)) {
      level++;
      break;
    }
  }
  level = Math.floor(level);
  if (level < 2) return 'weak';
  else if (level < 4) return 'medium';
  else return 'strong';
}


let output = checkStrength("123456");
output = checkStrength("pass!!!");
console.log(output);